//
//  GLGWRequestTool.h
//  GLGW_Shoping
//
//  Created by yang on 2018/11/9.
//  Copyright © 2018年 yang. All rights reserved.
//

#import <Foundation/Foundation.h>
/**
 请求成功的block

 @param response 响应体数据
 */
typedef void(^GLGWRequestSuccess)(id __nullable response);

/**
 自动缓存数据

 @param requestCache 缓存数据
 */
typedef void(^GLGWHttpRequestCache)(id __nullable requestCache);

/**
 请求失败的block

 @param error 扩展信息
 */
typedef void(^GLGWRequestFailure)(NSError *  __nullable error);
/**
 上传进度的block
 */
typedef void(^GLGWRequestProgress)(NSProgress *progress);
NS_ASSUME_NONNULL_BEGIN

@interface GLGWRequestTool : NSObject

#pragma mark =================== 带缓存POST ===================
+ (NSURLSessionTask *)POST_C:(NSString *)URL
                  lodingView:(UIView * __nullable)l_View
            lodingTextString:(NSString * __nullable)lodingStr
                    isLoding:(BOOL)loding
                  parameters:(id)parameters
               responseCache:(GLGWHttpRequestCache)responseDataCache
                     success:(GLGWRequestSuccess)success
                     failure:(GLGWRequestFailure)failure;
#pragma mark =================== 不带缓存POST ===================
+ (NSURLSessionTask *)POST:(NSString *)URL
                lodingView:(UIView * __nullable)l_View
          lodingTextString:(NSString * __nullable)lodingStr
                  isLoding:(BOOL)loding
                parameters:(id)parameters
                   success:(GLGWRequestSuccess)success
                   failure:(GLGWRequestFailure)failure;
#pragma mark =================== 上传图片 ===================
+ (NSURLSessionTask *)uploadImagesWithURL:(NSString *)URL
                               lodingView:(UIView * __nullable)l_View
                         lodingTextString:(NSString * __nullable)loding_Str
                               parameters:(id)parameters
                                     name:(NSString *__nullable)name
                                   images:(NSArray<UIImage *> *__nullable)images
                                fileNames:(NSArray<NSString *> *__nullable)fileNames
                               imageScale:(CGFloat)imageScale
                                imageType:(NSString *__nullable)imageType
                                 progress:(GLGWRequestProgress)myProgress
                                  success:(GLGWRequestSuccess)success
                                  failure:(GLGWRequestFailure)failure;
@end

NS_ASSUME_NONNULL_END
